package com.gxz.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

//@RestController
@Controller
public class MonsterController {
    //等价的写法
    //@RequestMapping(value = "/monster", method = RequestMethod.GET)
    @ResponseBody
    @GetMapping("/monster")
    public String getMonster() {
        return "GET-查询妖怪";
    }

    //@RequestMapping(value = "/monster", method = RequestMethod.POST)
    @ResponseBody
    @PostMapping("/monster")
    public String saveMonster() {

        return "POST-添加妖怪";
    }


    @PutMapping("/monster")
    @ResponseBody
    public String putMonster() {
        return "PUT-修改妖怪";
    }

    @DeleteMapping("/monster")
    @ResponseBody
    public String detMonster(){
        return "delete-删除妖怪";
    }

    @RequestMapping("/go")
    public String go(){
        return "hello"; //顺序 1 先看controller 有没有 /hello 2. 如果没有就到视图解析器
    }

}
